package models

import (
	"time"
)

type LgUser struct {
	ID				int					`gorm:"primary_key"`
	UserName		string				`gorm:"size:64;not null"`
	Msg				string				`gorm:"size:255"`
	Password		string				`gorm:"size:255;force"`
	Key				string				`gorm:"type:text;force"`
	AuthMethod   	string				`gorm:"size:16"`
	CreatedAt		time.Time			`json:"create_time"`
}


type  AssetLabel struct {
	ID				int					`gorm:"primary_key"`
	LabelName		string				`gorm:"size:32;not null;unique"`
	CreatedAt		time.Time			`json:"create_time"`
}

type  AssetIdc struct {
	ID				int					`gorm:"primary_key"`
	IdcName			string				`gorm:"size:32;not null;unique"`
	MgUser			string				`gorm:"size:32"`
	Mobile			string				`gorm:"size:16"`
	Email			string				`gorm:"size:32"`
	CreatedAt		time.Time			`json:"create_time"`
}

type  Asset struct {
	ID				int 				`gorm:"primary_key"`
	HostName		string				`gorm:"size:128;not null;"`
	Ip				string				`gorm:"size:32;not null;unique"`
	InnerIp			string				`gorm:"size:32"`
	Port			int
	Idc  			AssetIdc			`gorm:"foreignkey:IdcID"`
	IdcID			int
	Label			AssetLabel			`gorm:"foreignkey:LabelID"`
	LabelID			int
	LgUser  		LgUser				`gorm:"foreignkey:LgUserID"`
	LgUserID		int
	Status			bool				`gorm:"force"`
	AssetOs			AssetOs				`gorm:"FOREIGNKEY:AssetId;ASSOCIATION_FOREIGNKEY:ID"`
	AssetPartitions	[]AssetPartitions	`gorm:"FOREIGNKEY:AssetId;ASSOCIATION_FOREIGNKEY:ID"`
	AssetNic		[]AssetNic			`gorm:"FOREIGNKEY:AssetId;ASSOCIATION_FOREIGNKEY:ID"`
	CreatedAt		time.Time			`json:"create_time"`
}

type AssetOs struct {
	ID				int 				`gorm:"primary_key"`
	AssetId			int
	HostArp			string				`gorm:"size:128"`
	AssetType		string				`gorm:"size:128"`
	OsType			string				`gorm:"size:128"`
	OsVersion		string				`gorm:"size:128"`
	KernelVersion	string				`gorm:"size:128"`
	ProductName		string				`gorm:"size:128"`
	CPUModel		string				`gorm:"size:128"`
	CPUCoreCount	int
	MemorySize      int
	CreatedAt		time.Time			`json:"create_time"`
}

type AssetPartitions struct {
	ID				int 				`gorm:"primary_key"`
	AssetId			int
	Partition       string              `gorm:"size:128"`
	Mount		 	string              `gorm:"size:128"`
	SizeTotal 		int
	SizeAvaileble   int
	FsType		 	string              `gorm:"size:64"`
	CreatedAt		time.Time			`json:"create_time"`
}

type AssetNic struct {
	ID				int 				`gorm:"primary_key"`
	AssetId			int
	NicName       	string              `gorm:"size:128"`
	NicModel		string              `gorm:"size:64"`
	IpAddr 			string              `gorm:"size:64"`
	NetMask   		string              `gorm:"size:64"`
	Mac		 		string              `gorm:"size:64"`
	Mtu  		    int
	CreatedAt		time.Time			`json:"create_time"`
}
